#ifndef PARTICLE_COLLECTION
#define PARTICLE_COLLECTION

#include <vector>
#include <glm\glm.hpp>

//For defining a particle to add.
struct ParticleDef {
	glm::vec3 pos;
	glm::vec3 vel;
	float mass;
};

class ParticleCollection;

class ParticleIter {
	friend ParticleCollection;

public:

	ParticleIter(ParticleCollection *);

	glm::vec3 & pos();

	float & mass();

	glm::vec3 & vel();

	//Prefix operators
	ParticleIter & operator++ ();
	ParticleIter & operator-- ();

	//Postfix operators
	ParticleIter operator++ (int);
	ParticleIter operator-- (int);

	bool operator!= (const ParticleIter & rhs) const;
	bool operator== (const ParticleIter & rhs) const;

private:

	ParticleCollection * collection;
	unsigned int ndx;
};

//Holds a set of particles.
class ParticleCollection {
public:

	void Insert( const ParticleDef & inPart );

	void Remove( unsigned int partNum );

	ParticleIter Begin();

	unsigned int Size();

	ParticleIter End();

	ParticleIter operator[] ( unsigned int i );

protected:
	friend ParticleIter;

	//Positions
	std::vector< glm::vec3 > mPos;

	//Masses
	std::vector< float > mMass;

	//Vel
	std::vector< glm::vec3 > mVel;
};



#endif